/*
*   Copyright: Fabian Hajek (2012)  Programmieren: C   -   Semesterarbeit WS 2011/2012
*
*   Projekt: Schreinerei.exe
*
*   Author: $Author: webmaster@die-schwarzen-schwaben.de $
*
*   Name: func_input.c
*   URL:    $URL: http://semesterarbeit-wi-11-12.googlecode.com/svn/trunk/Semesterarbeit2/Schreinerei/Funktionen/func_input.c $
*
*   Description:   Verarbeitet die Benutzer-Eingaben und ruft entsprechende Funktionen auf
*
*   Last update:    $Date: 2012-02-17 18:14:08 +0000 (Fri, 17 Feb 2012) $
*
*   Rev:      $Rev: 53 $
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "func_input.h"
#include "../Definitionen/define.h"

char input(char func)
{
    char user_input[100];
    eingabe

    /*EINGEGEBENE DATEN AUF FUNKTION UEBERPRUEFEN*/

    func = (!strcmp(user_input,"exit"))?1:func;           /*EXIT == 1*/
    func = (!strcmp(user_input,"help"))?2:func;           /*HELP == 2*/
    func = (!strcmp(user_input,"info"))?3:func;           /*INFO == 3*/
    func = (!strcmp(user_input,"set_capital"))?4:func;    /*SET_CAPITAL == 4*/
    func = (!strcmp(user_input,"shop"))?5:func;           /*SHOP == 5*/
    func = (!strcmp(user_input,"new_el"))?6:func;         /*NEW_EL == 6*/
    func = (!strcmp(user_input,"stock"))?7:func;          /*STOCK == 7*/
    func = (!strcmp(user_input,"save"))?8:func;           /*SAVE == 8*/
    func = (!strcmp(user_input,"load"))?9:func;           /*LOAD == 9*/
    func = (!strcmp(user_input,"delete_el"))?10:func;      /*DELETE_EL == 10*/
    func = (!strcmp(user_input,"new_order"))?11:func;      /*NEW_ORDER == 11*/
    func = (!strcmp(user_input,"work"))?12:func;           /*WORK == 12*/

    char i = 1;
    switch(func)
    {
        case 1:
            return 0;
            break;
        case 2:
            help();
            return 1;
            break;
        case 3:
            info();
            return 1;
            break;
        case 4:
            while(i)
            {
                i = set_capital();
            }
            work(1.0f);
            return 1;
            break;
        case 5:
            while(i)
            {
                i = shop();
            }
            work(1.0f);
            return 1;
            break;
        case 6:
            new_el();
            work(1.0f);
            return 1;
            break;
        case 7:
            stock();
            return 1;
            break;
        case 8:
            save();
            return 1;
            break;
        case 9:
            load();
            return 1;
            break;
        case 10:
            delete_el();
            work(1.0f);
            return 1;
            break;
         case 11:
            new_order();
            work(1.0f);
            return 1;
            break;
        case 12:
            work(1.0f);
            return 1;
            break;
        default:
            printf("\n**************************************************\n");
            printf("%-14sBefehl nicht gefunden!%14s","*","*");
            printf("\n**************************************************\n");
            return 1;
    }
}
